<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <link type="text/css" href="#{request.contextPath}/UI/epss/epss.css" rel="stylesheet"/>
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
            function actSelect(obj) {
                var pkid = obj;
                var sfeature = "dialogwidth:1100px;dialogheight:600px;center:yes;location:no;help:no;resizable:no;scroll:yes;status:no";
                var arg = new Object();
                arg.doType = "select";
                var rtn = dialog("../item/itemMng_TkcttEngStaStl.xhtml?strEsInitStlSubcttEng=" + pkid + "", arg, sfeature);
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <h:form id="form" enctype="multipart/form-data">
            <p:growl id="msgs" showDetail="true"/>
            <p:focus for="id"/>
            <p:panel>
                <h:panelGrid id="pdQry" columns="3" style="width: 100%">
                    <h:panelGrid columns="8">
                        <p:outputLabel value="结算编号：" for="id"/>
                        <p:inputText id="id" value="#{esInitTkcttStlStaAction.progInfoShowQry.id}"/>
                        <p:outputLabel value="总包合同：" for="tkcttPkid"/>
                        <p:selectOneMenu id="tkcttPkid" value="#{esInitTkcttStlStaAction.progInfoShowQry.stlPkid}">
                            <f:selectItems value="#{esInitTkcttStlStaAction.tkcttList}"/>
                        </p:selectOneMenu>
                        <p:outputLabel value="期数编码：" for="periodNo"/>
                        <p:inputText id="periodNo" value="#{esInitTkcttStlStaAction.progInfoShowQry.periodNo}"
                                     onclick="WdatePicker({dateFmt:'yyyyMM'})"/>
		    </h:panelGrid>
                    <h:panelGrid columns="3">
                        <p:commandButton id="qryBtn" value="查询"
                                         action="#{esInitTkcttStlStaAction.onQueryAction('Mng','true')}"
                                         update="pdt,msgs,pgCondition">
                        </p:commandButton>
                        <p:commandButton id="resetBtn" value="重置"
                                         type="reset"
                                         update="pdQry,msgs">
                        </p:commandButton>
			<p:ajaxStatus style="width:16px;height:16px;">
                        <f:facet name="start">
                            <h:graphicImage value="/images/ajaxloading.gif"/>
                        </f:facet>
                        <f:facet name="complete">
                            <h:outputText value=""/>
                        </f:facet>
                    </p:ajaxStatus>
                </h:panelGrid>
                    </h:panelGrid>

            </p:panel>
            <h:panelGrid id="pgCondition" columns="4">
                <p:commandButton id="addBtn"
                                 value="增加" icon="ui-icon-plus"
                                 action="#{esInitTkcttStlStaAction.resetActionForAdd()}"
                                 update="pgViewForAdd,pgCondition"
                                 onclick="PF('wVDlgViewForAdd').show()">
                </p:commandButton>
                <p:commandButton id="endInputBtn" value="录入完成"
                                 action="#{esInitTkcttStlStaAction.onClickForPowerAction('MngPass')}"
                                 update="pgCondition,pdt,msgs"
                                 rendered="#{esInitTkcttStlStaAction.rowSelectedFlag}">
                </p:commandButton>
                <p:commandButton id="startInputBtn" value="录入未完"
                                 action="#{esInitTkcttStlStaAction.onClickForPowerAction('MngFail')}"
                                 update="pgCondition,pdt,msgs"
                                 rendered="#{esInitTkcttStlStaAction.rowSelectedFlag}">
                </p:commandButton>
            </h:panelGrid>
            <p:contextMenu for="pdt">
                <p:menuitem value="选择" icon="ui-icon-plus"
                            actionListener="#{esInitTkcttStlStaAction.selectRecordAction('Mng','Sel')}"
                            update="pdt,msgs,pgCondition">
                </p:menuitem>
                <p:menuitem value="更新" icon="ui-icon-arrowrefresh-1-w"
                            actionListener="#{esInitTkcttStlStaAction.selectRecordAction('Mng','Upd')}"
                            update="pgViewForUpd,pdt,msgs,pgCondition"
                            onclick="PF('wVDlgViewForUpd').show()">
                </p:menuitem>
                <p:menuitem value="删除" icon="ui-icon-close"
                            actionListener="#{esInitTkcttStlStaAction.selectRecordAction('Mng','Del')}"
                            update="pgViewForDel,pdt,msgs,pgCondition"
                            onclick="PF('wVDlgViewForDel').show()">
                </p:menuitem>
                <p:menuitem value="详细内容" icon="ui-icon-search"
                            oncomplete="actSelect(DtInitTkcttList.selection)">
                </p:menuitem>
            </p:contextMenu>
            <p:dataTable id="pdt" style="width:100%;"
                         value="#{esInitTkcttStlStaAction.progInfoShowList}"
                         var="record"
                         rowKey="#{record.pkid}"
                         selection="#{esInitTkcttStlStaAction.progInfoShowSelected}"
                         selectionMode="single"
                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         paginator="true"
                         paginatorPosition="bottom"
                         rows="15"
                         rowIndexVar="row"
                         rowsPerPageTemplate="500,200,100,45,30,15"
                         emptyMessage="数据记录为空..."
                         widgetVar="DtInitTkcttList"
                         rowStyleClass="#{record.statusFlag eq null? null:'rowDoneStyle'}"
                         scrollable="true">
                <p:column headerText="序号" style="width:30px">
                    <h:outputText value="#{row + 1}"/>
                </p:column>
                <p:column headerText="结算编号" style="width:120px;text-align:center">
                    <h:outputText value="#{record.id}"/>
                </p:column>
                <p:column headerText="总包合同" style="width:400px;text-align:left">
                    <h:outputText value="#{record.stlName}"/>
                </p:column>
                <p:column headerText="期数编码" style="width:60px;text-align:center">
                    <h:outputText value="#{record.periodNo}"/>
                </p:column>
                <p:column headerText="状态" style="width:66px;text-align:center">
                    <h:outputText value="#{esFlowControl.getLabelByValueInStatusFlaglist(record.statusFlag)}"/>
                </p:column>
                <p:column headerText="原因" style="width:66px;text-align:center">
                    <h:outputText value="#{esFlowControl.getLabelByValueInPreStatusFlaglist(record.preStatusFlag)}"/>
                </p:column>
            </p:dataTable>
            <p:dialog id="dlgViewForAdd" header="总包数量统计增加信息" widgetVar="wVDlgViewForAdd"
                      resizable="false" modal="true"
                      showEffect="clip" hideEffect="fold">
                 <h:panelGrid id="pgViewForAdd">
                    <h:panelGrid columns="3">
                        <p:outputLabel value="结算编号：" for="idForAdd"/>
                        <p:inputText id="idForAdd" value="#{esInitTkcttStlStaAction.progInfoShowAdd.id}"/>
                        <p:commandButton id="autoSetIdBtnForAdd" icon="ui-icon-plus"
                                         action="#{esInitTkcttStlStaAction.setMaxNoPlusOne()}"
                                         update="idForAdd"
                                         style="height:20px">
                        </p:commandButton>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <p:outputLabel value="总包合同：" for="tkcttPkidForAdd"/>
                        <p:selectOneMenu id="tkcttPkidForAdd"
                                                           value="#{esInitTkcttStlStaAction.progInfoShowAdd.stlPkid}">
                        <f:selectItems value="#{esInitTkcttStlStaAction.tkcttList}"/>
                    </p:selectOneMenu>
                    </h:panelGrid>
                    <h:panelGrid columns="4">
                        <p:outputLabel value="期数编码：" for="periodNoForAdd"/>
                        <p:inputText id="periodNoForAdd" value="#{esInitTkcttStlStaAction.progInfoShowAdd.periodNo}"
                                     onclick="WdatePicker({dateFmt:'yyyyMM'})"/>
                        <p:outputLabel value="备注内容：" for="noteForAdd"/>
                        <p:inputText id="noteForAdd" value="#{esInitTkcttStlStaAction.progInfoShowAdd.note}"
                                     style="width:176px"/>
                    </h:panelGrid>
                    <h:panelGrid id="pgOperBtnForAdd" columns="2">
                        <p:commandButton id="submitBtnForAdd"
                                         value="提交（增加）"
                                         action="#{esInitTkcttStlStaAction.onClickForMngAction}"
                                         update="pdt,msgs,pgViewForAdd">
                        </p:commandButton>
                        <p:commandButton id="resetBtnForAdd" value="重置"
                                         type="reset"
                                         update="pgViewForAdd">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
            </p:dialog>
            <p:dialog id="dlgViewForUpd" header="总包数量统计更新信息" widgetVar="wVDlgViewForUpd"
                      resizable="false" modal="true"
                      showEffect="clip" hideEffect="fold">
                <h:panelGrid id="pgViewForUpd">
                    <h:panelGrid columns="3">
                        <p:outputLabel value="结算编号：" for="idForUpd"/>
                        <p:inputText id="idForUpd" value="#{esInitTkcttStlStaAction.progInfoShowUpd.id}"/>
                        <p:commandButton id="autoSetIdBtnForUpd" icon="ui-icon-plus"
                                         action="#{esInitTkcttStlStaAction.setMaxNoPlusOne()}"
                                         update="idForUpd"
                                         style="height:20px">
                        </p:commandButton>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <p:outputLabel value="总包合同：" for="tkcttPkidForUpd"/>
                        <p:inputText id="tkcttPkidForUpd" value="#{esInitTkcttStlStaAction.progInfoShowUpd.stlName}"
                                readonly="true"
                                style="background-color:gainsboro;width: 328px;"/>
                    </h:panelGrid>
                    <h:panelGrid columns="4">
                        <p:outputLabel value="期数编码：" for="periodNoForUpd"/>
                        <p:inputText id="periodNoForUpd" value="#{esInitTkcttStlStaAction.progInfoShowUpd.periodNo}"
                                     onclick="WdatePicker({dateFmt:'yyyyMM'})"/>
                        <p:outputLabel value="备注内容：" for="noteForUpd"/>
                        <p:inputText id="noteForUpd" value="#{esInitTkcttStlStaAction.progInfoShowUpd.note}"/>
                    </h:panelGrid>
                    <h:panelGrid columns="4">
                        <p:outputLabel for="createdByNameUpd" value="创建人：" />
                        <h:inputText id="createdByNameUpd"
                                     value="#{esInitTkcttStlStaAction.progInfoShowUpd.createdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="createdDateUpd" value="创建时间：" />
                        <h:inputText id="createdDateUpd"
                                     value="#{esInitTkcttStlStaAction.progInfoShowUpd.createdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdByNameUpd" value="修改人：" />
                        <h:inputText id="lastUpdByNameUpd"
                                     value="#{esInitTkcttStlStaAction.progInfoShowUpd.lastUpdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdDateUpd" value="修改时间：" />
                        <h:inputText id="lastUpdDateUpd"
                                     value="#{esInitTkcttStlStaAction.progInfoShowUpd.lastUpdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="modificationNumUpd" value="修改次数：" />
                        <h:inputText id="modificationNumUpd"
                                     value="#{esInitTkcttStlStaAction.progInfoShowUpd.modificationNum}"
                                     style="background-color:gainsboro;text-align:right;" readonly="true">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0"/>
                        </h:inputText>
                    </h:panelGrid>
                    <h:panelGrid id="pgOperBtnForUpd" columns="2">
                        <p:commandButton id="submitBtnForUpd"
                                         value="提交（更新）"
                                         action="#{esInitTkcttStlStaAction.onClickForMngAction}"
                                         update="pdt,msgs,pgViewForUpd">
                        </p:commandButton>
                        <p:commandButton id="resetBtnForUpd" value="重置"
                                         type="reset"
                                         update="pgViewForUpd">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
            </p:dialog>
            <p:dialog id="dlgViewForDel" header="总包数量统计删除信息" widgetVar="wVDlgViewForDel"
                      resizable="false" modal="true"
                      showEffect="clip" hideEffect="fold">
                <h:panelGrid id="pgViewForDel">
                    <h:panelGrid columns="2">
                        <p:outputLabel value="结算编号：" for="idForDel"/>
                        <p:inputText id="idForDel" value="#{esInitTkcttStlStaAction.progInfoShowDel.id}"
                                     readonly="true"
                                     style="background-color:gainsboro;"/>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <p:outputLabel value="总包合同：" for="tkcttPkidForDel"/>
                        <p:inputText id="tkcttPkidForDel" value="#{esInitTkcttStlStaAction.progInfoShowUpd.stlName}"
                                     readonly="true"
                                     style="background-color:gainsboro;width: 328px;"/>
                    </h:panelGrid>
                    <h:panelGrid columns="4">
                        <p:outputLabel value="期数编码：" for="periodNoForDel"/>
                        <p:inputText id="periodNoForDel" value="#{esInitTkcttStlStaAction.progInfoShowDel.periodNo}"
                                     readonly="true"
                                     style="background-color:gainsboro;"/>
                        <p:outputLabel value="备注内容：" for="noteForDel"/>
                        <p:inputText id="noteForDel" value="#{esInitTkcttStlStaAction.progInfoShowDel.note}"
                                     readonly="true"
                                     style="background-color:gainsboro;"/>
                    </h:panelGrid>
                    <h:panelGrid columns="4">
                        <p:outputLabel for="createdByNameDel" value="创建人：" />
                        <h:inputText id="createdByNameDel"
                                     value="#{esInitTkcttStlStaAction.progInfoShowDel.createdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="createdDateDel" value="创建时间：" />
                        <h:inputText id="createdDateDel"
                                     value="#{esInitTkcttStlStaAction.progInfoShowDel.createdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdByNameDel" value="修改人：" />
                        <h:inputText id="lastUpdByNameDel"
                                     value="#{esInitTkcttStlStaAction.progInfoShowDel.lastUpdByName}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="lastUpdDateDel" value="修改时间：" />
                        <h:inputText id="lastUpdDateDel"
                                     value="#{esInitTkcttStlStaAction.progInfoShowDel.lastUpdDate}"
                                     style="background-color:gainsboro" readonly="true"/>
                        <p:outputLabel for="modificationNumDel" value="修改次数：" />
                        <h:inputText id="modificationNumDel"
                                     value="#{esInitTkcttStlStaAction.progInfoShowDel.modificationNum}"
                                     style="background-color:gainsboro;text-align:right;" readonly="true">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0"/>
                        </h:inputText>
                    </h:panelGrid>
                    <h:panelGrid id="pgOperBtnForDel" columns="2">
                        <p:commandButton id="submitBtnForDel"
                                         value="提交（删除）"
                                         action="#{esInitTkcttStlStaAction.onClickForMngAction}"
                                         update="pdt,msgs,pgViewForDel">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
            </p:dialog>
        </h:form>
    </ui:define>
</ui:composition>